//
//  TaskEarningsTableViewCell.m
//  BaishidaiKnight
//
//  Created by mac book on 2019/1/28.
//  Copyright © 2019年 sy. All rights reserved.
//

#import "TaskEarningsTableViewCell.h"


@interface TaskEarningsTableViewCell ()

@property(nonatomic,strong) UILabel* earningsLabel;
@property(nonatomic,strong) UILabel* totalLabel;


@property(nonatomic,strong) UILabel* earningsValueLabel;
@property(nonatomic,strong) UILabel* totalValueLabel;


@end


@implementation TaskEarningsTableViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
        [self createSubviews];
        
    }
    return self;
}

#pragma mark - createSubviews
-(void)createSubviews{
    
    
    
    [self.contentView addSubview:self.earningsLabel];
    [self.contentView addSubview:self.totalLabel];
    [self.contentView addSubview:self.earningsValueLabel];
    [self.contentView addSubview:self.totalValueLabel];
    
    
    [self.earningsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView).offset(10);
        make.left.equalTo(self.contentView).offset(10);
        make.width.equalTo(self.contentView).multipliedBy(0.5);
        make.height.mas_equalTo(25);
        
    }];
    
    [self.earningsValueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.earningsLabel);
        make.left.equalTo(self.earningsLabel.mas_right);
        make.right.equalTo(self.contentView).offset(-10);
        make.height.equalTo(self.earningsLabel);
        
    }];
    
    
    
    [self.totalLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.earningsLabel.mas_bottom);
        make.left.right.equalTo(self.earningsLabel);
        make.height.equalTo(self.earningsLabel);

    }];
    
    
    [self.totalValueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.totalLabel);
        make.left.equalTo(self.totalLabel.mas_right);
        make.right.equalTo(self.contentView).offset(-10);
        make.height.equalTo(self.totalLabel);
        
    }];
    
    
    
    self.earningsLabel.text = @"收益：";

    self.totalLabel.text = @"总计：";

    
    
    
}
-(void)setTaskModel:(TaskModel *)taskModel{
    
    _taskModel = taskModel;
    
    self.earningsValueLabel.text = taskModel.profit;
    self.totalValueLabel.text = taskModel.food_amount;

    
    
}

-(UILabel *)earningsLabel{
    if(!_earningsLabel){
        _earningsLabel = [[UILabel alloc]init];
        _earningsLabel.textColor =kMyColor(130, 130, 130);
        _earningsLabel.font = kFontNameSize(15);
    }
    return _earningsLabel;
}


-(UILabel *)totalLabel{
    if(!_totalLabel){
        _totalLabel = [[UILabel alloc]init];
        _totalLabel.textColor =kMyColor(130, 130, 130);
        _totalLabel.font = kFontNameSize(15);
    }
    return _totalLabel;
}

-(UILabel *)earningsValueLabel{
    if(!_earningsValueLabel){
        _earningsValueLabel = [[UILabel alloc]init];
        _earningsValueLabel.textColor =kMyColor(130, 130, 130);
        _earningsValueLabel.font = kFontNameSize(15);
        _earningsValueLabel.textAlignment = NSTextAlignmentRight;
    }
    return _earningsValueLabel;
}


-(UILabel *)totalValueLabel{
    if(!_totalValueLabel){
        _totalValueLabel = [[UILabel alloc]init];
        _totalValueLabel.textColor =kMyColor(130, 130, 130);
        _totalValueLabel.font = kFontNameSize(15);
        _totalValueLabel.textAlignment = NSTextAlignmentRight;
    }
    return _totalValueLabel;
}






- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
